package com.test.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ManHandler implements InvocationHandler {
    private Man man;

    public ManHandler(Man man) {
        this.man = man;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        before();
        method.invoke(man, null);
        after();
        return null;
    }

    public void before() {
        System.out.println("println for before");
    }

    public void after() {
        System.out.println("println for after");
    }
}
